<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
{{assign var="title" value='角色编辑'}}
{{assign var="app" value='role'}}
{{assign var="act" value=''}}
<title>{{$title}} - {{'admin|admin_site_name'|C|default:'后台管理'}}</title>
{{include file="include/base.html"}}

	<link rel="stylesheet" href="{{$smarty.const.__SHARE__}}plug/ztree/css/zTreeStyle.css" type="text/css">
	<script type="text/javascript" src="{{$smarty.const.__SHARE__}}plug/ztree/js/jquery.ztree.core-3.4.js"></script>
	<script type="text/javascript" src="{{$smarty.const.__SHARE__}}plug/ztree/js/jquery.ztree.excheck-3.4.js"></script>
	<SCRIPT type="text/javascript">
	var zNodes=eval({{$trees}});//json
	var setting = {
		check: {enable: true},
		data: {simpleData: {enable: true}},
		callback: {onCheck: onCheck}
	};
	
	function onCheck(e, treeId, treeNode) {
	   var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
	   nodes = zTree.getCheckedNodes(true),
	   v = "";
	   ids=new Array();
	   for (var i=0, l=nodes.length; i<l; i++) {
		v += nodes[i].name + ",";
		//alert(nodes[i].id);   //获取选中节点的id值
		ids[i]=nodes[i].id;
	   }
	   $('#module_ids').val(ids.join(','));
	}
	$(document).ready(function(){
		$.fn.zTree.init($("#treeDemo"), setting, zNodes);
	});
	</SCRIPT>

</head>
<body>

	{{include file="include/sidebar.html"}}
	
	<div class="body_right">
	<div id="content">
	
	<div class="search">
	  <ul class="bread">
		<li>◆ {{$title}}管理 －＞ {{$title}}</li>
	  <ul>
	</div>
			
		<!--内容 S-->
		<form action="index.php?app={{$app}}&act=save" name="form1" class="form ajaxSubmit" id="form" method="post">
		<input type="hidden" name="id" value="{{$one.id|default:''}}"/>
		<input type="hidden" name="publish" value="{{$one.publish|default:1}}"/>
		<table class="table table-bordered modify">
		  <tbody>
			<tr>
			  <td>名称：</td>
			  <td>
				<input class="input-xlarge" name="name" class="required" type="text" size="30" value="{{$one.name|default:''}}" alt=""/> <span class="red">*</span>
			  </td>
			</tr>
			<tr>
			  <td>授权：</td>
			  <td>
				<input type="hidden" name="module_ids" value="{{$one.module_ids|default:''}}" id="module_ids"/>
				<div id="treeDemo" class="ztree"></div>
				<span class="red">*</span>
			  </td>
			</tr>
		  </tbody>
		 </table>
		<div class="bottom_button">
			<button type="submit" class="btn btn-info"><i class="icon-ok icon-white"></i>确认</button>
		</div>
		</form>
		<!--内容 E-->
		
</div>
</div>

</body>
</html>